#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int main()
{
    string as;
    cin >> as;
    string ac;
    ac.push_back(as[0]);
    for (int i = 1; i < as.size(); i++)
    {
        if (ac.back() == as[i])
        {
            ac.pop_back();
        }
        else {
            ac.push_back(as[i]);
        }
    }
    if (ac.size() == 0)
        cout << 0;
    else
        cout << ac;
    return 0;
}